package com.leoandroid.tool.toolsbox.largeread.activity

import android.os.Bundle
import android.view.View
import com.leoandroid.tool.toolsbox.largeread.databinding.ActivityRulerBinding


class RulerActivity: com.leoandroid.tool.toolsbox.largeread.activity.BaseActivity(){

    var bindingF: ActivityRulerBinding?=null
    val binding get() = bindingF!!
    var num = 20f
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        bindingF = ActivityRulerBinding.inflate(layoutInflater)
        setContentView(binding.root)

        binding.horScrollview.overScrollMode = View.OVER_SCROLL_NEVER
        binding.ruleView.setHorizontalScrollView(binding.horScrollview)
        binding.ruleView.setDefaultScaleValue(num)
        binding.horScrollview.setOnScrollListener {
                l, t, oldl, oldt ->
            binding.ruleView.setScrollerChanaged(l,t,oldl,oldt)
        }

        binding.ruleView.onChangedListener(object: com.leoandroid.tool.toolsbox.largeread.view.RuleView.onChangedListener{
            override fun onSlide(number: Float) {
                var nn = number
                binding.numTv.text = "当前刻度是："+nn
            }

        })
    }
}